function  res = getStdSpectrum(obj, varargin)
%GETSTDSPECTRUM Summary of this function goes here
%   Detailed explanation goes here
    %%
    isnoneg = @(x)  isnumeric(x) && x > 0;
    offsetTest = @(x) x <= 5 && x >= -5;
    chTest = @(x) ismember(x, 1:4);
    rangeTest = @(x) ismember(x, [10, 1, 0.1, 0.01]);
    p=inputParser;
    p.addParameter('grid_cols', 8192, isnoneg);
    p.addParameter('frequencyspan', 400, isnoneg);
    p.addParameter('modulation_ch', 3, chTest);
    p.addParameter('modulation_amp', 0.050, isnoneg);
    p.addParameter('modulation_freq', 60.0, isnoneg);
    p.addParameter('modulation_offset', 0.0, offsetTest);
    p.addParameter('Z1control_range', 0.1, rangeTest);
    p.parse(varargin{:});
    
    %%
    sess = obj.session;
    zi=sess.getDevice(obj.master);
    
    ch = p.Results.modulation_ch;     amp =  p.Results.modulation_amp;    range = p.Results.Z1control_range;
    freq =  p.Results.modulation_freq;    offset =  p.Results.modulation_offset;
    obj.disableZ1CoilAmplitude().enableZ1CoilAmplitude(3);
    obj.setZ1ControlRange(range).setZ1CoilAmplitude(ch, amp).setZ1CoilFrequency(ch, freq).setZ1CoilOffset(offset);
    obj.enableZ1CoilModulation();
    
    %%
    spectrum = zi.spectrumModule(sess);
%     spectrum.load_settings([PROJ_PATH 'settings.mat'], 'sptrm_settings');

    spectrum.setControl('grid_cols', p.Results.grid_cols);
    spectrum.setControl('spectrum_frequencyspan', p.Results.frequencyspan);
    

    spectrum.subscribeChannel('3', 'X.fft.abs.avg');
    res = spectrum.run();
    spectrum.unsubscribeChannel();
    
    obj.dev.ziSlave.disableOutAmplitude();
    
    res.modulation_amp = amp;
    res.modulation_freq = freq;
    res.modulation_offset = offset;
end

